#ifndef __PROJECT_DOC_MGR_H__
#define __PROJECT_DOC_MGR_H__

#include "tinyxml/tinyxml.h"
#include <string>
using namespace std;

class ProjectDocMgr
{
public:
    ProjectDocMgr();
    ~ProjectDocMgr();
	void loadProjectFile( const string & docPath );
	TiXmlElement* getElement( const string & name );
	TiXmlElement* getElementById( const string & id );
	TiXmlElement* getFileByPath( const string & path );
	void modifyLogInfo( const string & id ,const string & name,const string & text );
private:

	void checkIntegration(  TiXmlElement* elem );
	void fixFileLang( TiXmlElement* elem );
	void fixTargetLang( TiXmlElement* elem );
	void tryFixTargetOutDir( TiXmlElement* elem );

	TiXmlElement* searchElementByName( TiXmlElement* root,const string & name );
	TiXmlElement* searchElementById( TiXmlElement* root,const string & id );

	TiXmlElement* searchFileByPath( TiXmlElement* root,const string & path );

private:
	string				m_ProjectFileName;
	TiXmlDocument		*m_Xml;
	TiXmlElement		*m_Root;
	bool				m_ModifyFlag;
};

#endif // __PROJECT_DOC_MGR_H__